using System;
using System.Collections.Generic;
using System.Text;

namespace Lincolnwood.Foundation.SermonLibrary
{
    [Serializable]
    public class Speaker
    {
        private string _title;
        private string _firstName;
        private string _lastName;

        public Speaker()
        { }

        public Speaker(string firstName, string lastName, string title)
        {
            _title = title;
            _firstName = firstName;
            _lastName = lastName;
        }

        /// <summary>
        /// Title: Pastor, Deacon, etc.
        /// </summary>
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        /// <summary>
        /// The given name of the person.
        /// </summary>
        public string FirstName
        {
            get { return _firstName; }
            set { _firstName = value; }
        }

        /// <summary>
        /// The last name of the person.
        /// </summary>
        public string LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }

        public string NameAndTitle
        {
            get {return this.Title + " " + this.FirstName + " " + this.LastName;}
        }

        public override bool Equals(object obj)
        {
             var testSpeaker = obj as Speaker;
            if (testSpeaker == null)
                return false;
            else
                return Equals(testSpeaker);
        }

        private bool Equals(Speaker arg)
        {
            if (this == arg)
                return true;

            return 
            FirstName.Equals(arg.FirstName) &&
            LastName.Equals(arg.LastName) &&
            Title.Equals(arg.Title);
        }
    }
}
